package com.kx.yooli.kx.wechat.mapper.nplm;

import com.kx.yooli.kx.wechat.entity.nplm.CustInfo;
import com.kx.yooli.kx.wechat.entity.nplm.NplmLoanContract;
import com.kx.yooli.kx.wechat.entity.nplm.NplmOvrdueCase;
import com.kx.yooli.kx.wechat.entity.nplm.OverdueCase;
import com.mybatisflex.annotation.UseDataSource;
import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.query.QueryWrapper;

import java.util.List;

public interface NplmOverdueCaseMapper extends BaseMapper<NplmOvrdueCase> {
    @UseDataSource("ds4")
    default List<NplmOvrdueCase> selectByCertNo(String idCard){
        return selectListByQuery(QueryWrapper.create()
                .select(NplmOvrdueCase::getLoanNo,NplmOvrdueCase::getCertNo)
                .from(NplmOvrdueCase.class).where(NplmOvrdueCase::getCertNo).eq(idCard).groupBy(NplmOvrdueCase::getLoanNo,NplmOvrdueCase::getCertNo));
    }
    @UseDataSource("ds4")
    default  List<NplmOvrdueCase> selectByLoanNo(List<String> loan){
        return  selectListByQuery(QueryWrapper.create().select(NplmOvrdueCase::getLoanNo,NplmOvrdueCase::getCertNo).from(NplmOvrdueCase.class).where(NplmOvrdueCase::getLoanNo).in(loan).groupBy(NplmOvrdueCase::getLoanNo,NplmOvrdueCase::getCertNo));
    }
    @UseDataSource("ds4")
    default List<NplmOvrdueCase> selectByIdCard(List<String> loanNo){
        return  selectListByQuery(QueryWrapper.create().select(NplmOvrdueCase::getCertNo,NplmOvrdueCase::getLoanNo).from(NplmOvrdueCase.class)
                .where(NplmOvrdueCase::getLoanNo).in(loanNo).groupBy(NplmOvrdueCase::getCertNo,NplmOvrdueCase::getLoanNo)
        );
    }


}
